package com.rental.user.client;

import com.rental.common.result.AjaxResult;
import com.rental.model.dto.UserInfoDto;
import com.rental.model.entity.user.UserInfo;
import com.rental.model.form.user.GetRecordForm;
import com.rental.model.form.user.PhoneAndCodeForm;
import com.rental.model.vo.user.RecordVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.ArrayList;
import java.util.List;

@FeignClient(name = "user-server")
public interface UserInfoFeignClient {

    @PostMapping("/userInfo/sendCode")
    AjaxResult<String> sendCode(@RequestBody PhoneAndCodeForm phoneAndCodeForm);

    @PostMapping("/userInfo/login")
    AjaxResult<String> login(@RequestBody PhoneAndCodeForm phoneAndCodeForm);

    @GetMapping("/userInfo/getUserInfo")
    AjaxResult<UserInfo> getUserInfo(@RequestParam("token") String token);

    @GetMapping("/userInfo/getUserById")
    AjaxResult<UserInfo> getUserById(@RequestParam("id") Long id);

    @GetMapping("/userInfo/getUserInfoById")
    AjaxResult<UserInfo> getUserInfoById(@RequestParam("id") Long id);

    @PostMapping("/userInfo/updateUserInfoById")
    public AjaxResult<Boolean> updateUserInfoById(@RequestBody UserInfo userInfo);

    @GetMapping("/userInfo/getAllUserInfo")
    public AjaxResult<List<UserInfo>> getAllUserInfo();

    /**
     * 获取浏览记录
     *
     * @param getRecordForm 请求表单
     * @return 浏览记录
     */
    @PostMapping("/userInfo/getBrowseRecord")
    AjaxResult<RecordVo> getBrowseRecord(@RequestBody GetRecordForm getRecordForm);

    /**
     * 获取收藏信息
     *
     * @param getRecordForm 请求表单
     * @return 收藏信息
     */
    @PostMapping("/userInfo/getCollectInfo")
    AjaxResult<RecordVo> getCollectInfo(@RequestBody GetRecordForm getRecordForm);

    /**
     * 获取用户发布页面
     *
     * @param getRecordForm 请求表单
     * @return 发布页面
     */
    @PostMapping("/userInfo/getPublish")
    AjaxResult<RecordVo> getPublish(@RequestBody GetRecordForm getRecordForm);

    /**
     * 统计平台拉黑的中介数
     *
     * @return 统计结果
     */
    @Operation(summary = "统计平台拉黑的中介数")
    @GetMapping("/userInfo/countBannedUser")
    AjaxResult<Long> countBannedUser();
}
